import request from '@/utils/request'

export const getFile = async (file) => {
  if (!file) {
    return null
  }
  //用于存储url
  let generatedUrl = ''
  //获取响应结果
  const response = (
    await request.get(`/general/getFile?realFilePath=${file}`, {
      responseType: 'blob', //设置响应类型为blob
    })
  ).data
  //生成url
  generatedUrl = URL.createObjectURL(response)
  //返回url
  return generatedUrl
}
